package com.party.core.service.partner.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.partner.PartnerLabelReadDao;
import com.party.core.dao.read.partner.PartnerMemberLabelReadDao;
import com.party.core.dao.write.partner.PartnerMemberLabelWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.partner.PartnerMemberLabel;
import com.party.core.service.partner.IPartnerMemberLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 会员标签接口实现
 * @author: Huaqunhao
 * @create: 2018-08-21 17:57
 **/
@Service
@Transactional
public class PartnerMemberLabelService implements IPartnerMemberLabelService {

    @Autowired
    private PartnerMemberLabelWriteDao partnerMemberLabelWriteDao;

    @Autowired
    private PartnerMemberLabelReadDao partnerMemberLabelReadDao;

    @Override
    public String insert(PartnerMemberLabel partnerMemberLabel) {
        BaseModel.preInsert(partnerMemberLabel);
        boolean result = partnerMemberLabelWriteDao.insert(partnerMemberLabel);
        if (result){
            return partnerMemberLabel.getId();
        }
        return null;
    }

    @Override
    public boolean update(PartnerMemberLabel partnerMemberLabel) {
        partnerMemberLabel.setUpdateDate(new Date());
        return partnerMemberLabelWriteDao.update(partnerMemberLabel);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return  partnerMemberLabelWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public PartnerMemberLabel get(String id) {
        return null;
    }

    @Override
    public List<PartnerMemberLabel> listPage(PartnerMemberLabel partnerMemberLabel, Page page) {
        return null;
    }

    @Override
    public List<PartnerMemberLabel> list(PartnerMemberLabel partnerMemberLabel) {
        return null;
    }

    @Override
    public List<PartnerMemberLabel> batchList(Set<String> ids, PartnerMemberLabel partnerMemberLabel, Page page) {
        return null;
    }

    @Override
    public void deleteLable(String labelId) {
        partnerMemberLabelWriteDao.deleteLable(labelId);
    }

    @Override
    public int getLabelNum(String organizationId, String labelId) {
        return partnerMemberLabelReadDao.getLabelNum(organizationId,labelId);
    }

    @Override
    public PartnerMemberLabel getMemberLabel(String organizationId, String memberId) {
       return partnerMemberLabelReadDao.getMemberLabel(organizationId,memberId);
    }
}
